package com.situ.day9;

import org.junit.Test;

import java.util.Arrays;

public class Demo {
    @Test
    public void test1() {
        Student student = new Student();
        student.show();
        student.id = 1;

        //静态的属性和方法当类加载时候就可以调用，这个时候没有任何对象
        //Static member 'com.situ.day9.Student.country' accessed via instance reference
        //student.country = "中";
        Student.country = "国";
        //Static member 'com.situ.day9.Student.print()' accessed via instance reference
        student.print();
        Student.print();

        //工具类
        int max1 = Math.max(3, 2);
        System.out.println(max1);
        double max2 = Math.max(3.0, 5.2);
        System.out.println(max2);
        //'Math()' has private access in 'java.lang.Math'
        //Math math = new Math();

        //Arrays数组操作的工具类
        int[] array = {34, 45, 7, 89};
        System.out.println(array);//[I@d7b1517
        System.out.println(Arrays.toString(array));
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));
        int index = Arrays.binarySearch(array, 7);
        System.out.println(index);

        int sum = ArraysUtil.sum(array);
        System.out.println(sum);
        ArraysUtil.bubbleSort(array);
        System.out.println(Arrays.toString(array));

    }

    @Test
    public void test45() {
        //public static final int   MAX_VALUE = 0x7fffffff;
        System.out.println(Integer.MAX_VALUE);

        //自动装箱和自动拆箱
        Integer integer1 = new Integer(4);
        System.out.println(integer1);//4
        Integer integer2 = 4;//自动装箱
        System.out.println(integer2);//4
        //int i = integer2.intValue();
        int num1 = integer2;//自动拆箱
        System.out.println(num1);//4

        Integer integer = 3;
        int num2 = integer + 4;
        integer = integer + 5;
    }

    @Test
    public void test78() {
        String str1 = "23";
        int i = Integer.parseInt(str1);
        i = i + 1;
        System.out.println(i);
        System.out.println(Double.parseDouble("3.14"));
    }



}
